<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
defined('_JEXEC') or die;

jimport('joomla.application.component.view');

class CprojectViewSection extends JView {

    protected $item;
    protected $form;

    public function display($tpl = null) {
        $this->item = $this->get('Item');
        $this->form = $this->get('Form');

        if (count($errors = $this->get('Errors'))) {
            JError::raiseError(500, implode("\n", $errors));
            return false;
        }

        //Them Toolbar 
        $this->addToolbar();

        //Tieu de
        $this->setDocument();
        parent::display($tpl);
    }

    protected function addToolbar() {
        JRequest::setVar('hidemainmenu', true);
        $user		= JFactory::getUser();
        
        $isNew = ($this->item->id == 0);
        
        $status = ($isNew) ? 'Add New' : 'Edit';
        JToolBarHelper::title(JText::_('Section Manger') . '&nbsp;<small class="jast-small">[' . $status . ']</small>');
        
        JToolBarHelper::apply('section.apply', 'JTOOLBAR_APPLY');
        JToolBarHelper::save('section.save');
        JToolBarHelper::cancel('section.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE');
    }

    function setDocument() {
        $document = JFactory::getDocument();
        $document->setTitle(JText::_("Section Manager "));
    }

}

?>
